package cn.edu.hitwh.kanlema.task;

import cn.edu.hitwh.kanlema.service.IVoucherOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class VoucherCachePreloader {
    @Autowired
    private IVoucherOrderService voucherOrderService;

    // 每天 0 点缓存优惠券信息
    @Scheduled(cron = "0 0 0 * * ?")
    public void preloadVoucherStock() {
        voucherOrderService.preloadVouchers();
    }
}